
package com.scs.application.modules.settlement.mapper;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.scs.application.modules.settlement.entity.BillItem;
import com.scs.application.modules.settlement.request.BillItemQueryRequest;
import com.scs.application.modules.settlement.vo.BillItemVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 记账单明细 mapper对象
 */
@Mapper
public interface BillItemMapper extends BaseMapper<BillItem> {

    /**
     * 获取记账金额
     * @param billId
     * @return
     */
    Double totalAmount(String billId);

    IPage<BillItemVO> page(IPage page, @Param("request")BillItemQueryRequest request);

    IPage<BillItemVO> pageForInvoice(IPage page, @Param("request")BillItemQueryRequest request);

    List<BillItemVO> listForInvoice(@Param("request") BillItemQueryRequest request);

    List<BillItemVO> listBillItems(@Param("request") BillItemQueryRequest request);


    // 开票新增查询
    IPage<BillItemVO> pageForInvoiceAdd(
            IPage<BillItemVO> page,
            @Param(Constants.WRAPPER) QueryWrapper<BillItemVO> queryWrapper,
            @Param("hospitalId") String hospitalId,
            @Param("groupBySql") String groupBySql,
            @Param("orderBySql") String orderBySql
    );

    // 开票新增查询
    List<BillItemVO> listDtlForInvoiceAdd(
            @Param(Constants.WRAPPER) QueryWrapper<BillItemVO> queryWrapper
    );
}
